<#assign filePath>${project.projectName}/${project.projectName}-biz/src/main/java/${project.basePackage?replace(".","/")}/${model.moduleName?replace(".","/")}/model/</#assign>
<#assign fileName>${model.name?cap_first}${method.name?cap_first}${method.type?ends_with('CMD')?then("Cmd", "Query")}.java</#assign>
package ${project.basePackage}.${model.moduleName}.model;

<#assign importPkgs=['io.swagger.v3.oas.annotations.media.Schema','lombok.Data']>
<#if method.type=='CREATE_CMD'>
    <#assign importPkgs=importPkgs+["com.fa4j.common.base.model.AbstractCmd"]>
    <#assign parentClass = "extends AbstractCmd ">
<#elseif method.type=='MODIFY_CMD'>
    <#assign importPkgs=importPkgs+["com.fa4j.common.base.model.ModifyCmd"]>
    <#list model.fieldList as field>
        <#if model.primaryFieldId?? && model.primaryFieldId == field.id >
            <#assign primaryField= field>
        </#if>
    </#list>
    <#assign parentClass = "extends ModifyCmd<"+primaryField.type.type.simpleName+"> ">
<#elseif method.type=='PAGE_QUERY'>
    <#assign importPkgs=importPkgs+["com.fa4j.common.base.model.PageQuery"]>
    <#assign parentClass = "extends PageQuery ">
<#else>
    <#stop>
</#if>
<#list method.paramFields as field>
    <#if field.type!='OBJECT' && !importPkgs?seq_contains(field.type.type.packageName)>
        <#assign importPkgs=importPkgs+[field.type.type.name]>
    </#if>
    <#if method.type=='PAGE_QUERY' && field.queryType?? && !importPkgs?seq_contains("com.fa4j.common.data.annotation.Query")>
        <#assign importPkgs=importPkgs+["com.fa4j.common.data.annotation.Query","com.fa4j.common.data.model.QueryType"]>
    </#if>
    <#if field.required>
        <#if field.type=="STRING" && !importPkgs?seq_contains("jakarta.validation.constraints.NotBlank")>
            <#assign importPkgs=importPkgs+["jakarta.validation.constraints.NotBlank"]>
        <#elseif !importPkgs?seq_contains("jakarta.validation.constraints.NotNull")>
            <#assign importPkgs=importPkgs+["jakarta.validation.constraints.NotNull"]>
        </#if>
    </#if>
    <#if field.type=="STRING" >
        <#if field.length?? && field.length gt 0 &&  !importPkgs?seq_contains("jakarta.validation.constraints.Size")>
            <#assign importPkgs=importPkgs+["jakarta.validation.constraints.Size"]>
        </#if>
        <#if field.pattern!""?length gt 0 &&  !importPkgs?seq_contains("jakarta.validation.constraints.Pattern")>
            <#assign importPkgs=importPkgs+["jakarta.validation.constraints.Pattern"]>
        </#if>
    </#if>
    <#if field.isList?? && field.isList &&  !importPkgs?seq_contains("java.util.List")>
        <#assign importPkgs=importPkgs+["java.util.List"]>
    </#if>
</#list>
<#list importPkgs?filter(p->!p?starts_with("java.lang"))?sort as pkg>
import ${pkg};
</#list>

@Data
@Schema(description = "${model.remark}${method.remark}参数")
public class ${model.name?cap_first}${method.name?cap_first}${method.type?ends_with('CMD')?then("Cmd", "Query")} ${parentClass}{

    <#list method.paramFields as field>
        <#if field.name=='id'><#continue ></#if>
        <#if field.type=='OBJECT'>
            <#assign fieldModel=models[field.modelId?string] >
            <#assign fieldType=fieldModel.name?cap_first >
        <#else >
            <#assign fieldType=field.type.type.simpleName >
        </#if>
    <#if method.type?ends_with('QUERY') && field.queryType??>
    @Query(type = QueryType.${field.queryType})
    </#if>
    <#if field.required>
        <#if fieldType=="String">
    @NotBlank
        <#else>
    @NotNull
        </#if>
    </#if>
    <#if fieldType=="String" >
        <#if field.length?? && field.length gt 0 >
    @Size(max = ${field.length})
        </#if>
        <#if field.pattern!""?length gt 0>
    @Pattern(regexp ="${field.pattern}" )
        </#if>
    </#if>
    @Schema(description = "${field.remark}")
    <#if field.isList?? && field.isList>
    private List<${fieldType}> ${field.name};
    <#else>
    private ${fieldType} ${field.name};
    </#if>

    </#list>
}
